﻿<view:AViewPage
    x:Class="OneBusAway.WP7.View.SettingsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:data="clr-namespace:OneBusAway.WP7.ViewModel;assembly=OneBusAway.WP7.ViewModel" 
    xmlns:view="clr-namespace:OneBusAway.WP7.View;assembly=OneBusAway.WP7.View"
    xmlns:local="clr-namespace:OneBusAway.WP7.View"
    xmlns:tilt="clr-namespace:ControlTiltEffect"
    xmlns:toolbox="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    tilt:TiltEffect.IsTiltEnabled="True"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource OBAForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <view:AViewPage.Resources>
        <data:SettingsVM x:Key="ViewModel" />
        <view:PivotNameConverter x:Key="PivotNameConverter" />
    </view:AViewPage.Resources>
    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="{StaticResource OBAPrimaryBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="11" />
            <ColumnDefinition Width="469" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Margin="1,16,0,27" Grid.Column="1">
            <TextBlock x:Name="PageTitle" Text="settings" 
                Foreground="{StaticResource OBAForegroundBrush}"
                Margin="9,-8,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="1,0,12,0" Grid.Column="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                
                <toolbox:ToggleSwitch
                    x:Name="ReportUsageTs"
                    Grid.Row="0"
                    IsChecked="{Binding Path=FeedbackEnabled, Source={StaticResource ViewModel}, Mode=TwoWay}"
                    Foreground="{StaticResource OBAForegroundBrush}"
                    Header="Send feedback"
                    />

                <TextBlock 
                    Grid.Row="1"
                    Margin="10,-20,0,0"
                    Foreground="{StaticResource OBAForegroundBrush}"
                    FontSize="{StaticResource PhoneFontSizeSmall}"
                    Text="Sending anonymous usage data allows us to better improve the OneBusAway app.  We will never report your location or any personally-identifying information. You must restart OneBusAway for any changes to this setting to take effect."
                    TextWrapping="Wrap"
                    />
            </Grid>
            
            <toolbox:ListPicker 
                x:Name="DefaultPivotLp"
                ItemsSource="{Binding Path=MainPagePivotOptions, Source={StaticResource ViewModel}, Converter={StaticResource PivotNameConverter}}"
                SelectedItem="{Binding Path=SelectedMainPagePivot, Source={StaticResource ViewModel}, Converter={StaticResource PivotNameConverter}, Mode=TwoWay}"
                Header="Default pivot when starting OneBusAway"
                />

            <TextBlock
                Text="Clear recents and cache"
                Foreground="{StaticResource OBASubtleBrush}"
                Margin="10,0,0,0"
                />
            <Button Content="delete local cache" Name="clear_history_button"  Click="appbar_clear_history_Click"
                    Foreground="{StaticResource OBAForegroundBrush}"
                    BorderBrush="{StaticResource OBAForegroundBrush}"
                    HorizontalAlignment="Stretch" VerticalAlignment="Top"
                    />
        </StackPanel>
    </Grid>

</view:AViewPage>
